# -*- coding: utf-8 -*-
# @Time    : 2020/5/7 20:12
# @Author  : Jhin•W
# @Email   : 261229090@qq.com
# @File    : client.py
# @Software: PyCharm
#---------------------------------------------------

import socket

sk = socket.socket()
address = ('127.0.0.1', 8000)
sk.connect(address)

#client
#(<socket.socket fd=504, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0
#server
#(<socket.socket fd=504, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 8000), raddr=('127.0.0.1', 55210)>, ('127.0.0.1', 55210))

#注意 两个sk没有任何关系

'''
server下的方法
    bind()
    listen()
    accept()
    
    recv()
    send(string)
    sendall()

client下的方法
    connect()
    recv()  bytes类型
    send(string) bytes类型
    sendall()
    
close()
'''

data = sk.recv(1024)
print(str(data, 'utf8'))

sk.close()